/*
 * workflow_struct.h
 *
 *  Created on: Dec 12, 2012
 *      Author: afretign
 */

#ifndef WORKFLOW_STRUCT_H_
#define WORKFLOW_STRUCT_H_

#define NOT_STARTED 0
#define RUNNING 1
#define COMPLETED 2
struct transition{
	char * condition;
	char * to;
	char * id;
	char * from;
};
struct variable{
	char * name;
	char * type;
	char * value;
};
struct activity{
	char * id;
	char * name;
	char * description;
	char * performer;
	int state;
	char ** input;
	char ** output;
	int nbInput;
	int nbOutput;
};
struct process{
	char * description;
	struct variable * variables;
	struct activity * activities;
	struct transition * transitions;
	int state;
	int nbVariables;
	int nbActivities;
	int nbTransitions;
};

struct tableProcess{
	struct process**processes;
	int nbProcesses;
};

struct personne{
	int socket;
	char* login;
	char* nom;
	char* prenom;
};
struct tableUser{
	struct personne* users;
	int nbUser;
};
struct boite{
	int* numero;
	int nb;
};
extern int allCompleted(struct process*,char *);
extern struct variable * valeur(struct variable *,char *,int);
extern struct transition ** findTransitionsInversees(struct process*,struct activity,int *);
extern struct transition ** findTransitions(struct process*,struct activity,int *);
extern struct activity ** findByPerformer(char*,struct process *,int *);
extern int activityById(char*,struct process*);
extern char * variableToString(struct variable );
extern char * activiteToString(struct activity );
extern char * activiteToShortString(struct activity,int);
extern char * transitionToString(struct transition );
#endif /* WORKFLOW_STRUCT_H_ */
